package route

import "github.com/kataras/iris"

func Init()  {
	app := iris.New()
	app.RegisterView(iris.HTML("./view", ".html"))

	app.Get("/", func(ctx iris.Context) {
		// Bind: {{.message}} with "Hello world!"
		ctx.ViewData("message", "Hello dsl!")
		// Render template file: ./views/hello.html
		ctx.View("hello.html")
	})

	app.Get("/user/{id:long}", func(ctx iris.Context) {
		userID, _ := ctx.Params().GetInt64("id")
		ctx.Writef("User ID: %d", userID)
	})

	// Start the server using a network address.
	app.Run(iris.Addr(":8080"))
}